package com.simplefan.system.common.Rest;

import com.simplefan.framework.common.rest.RestObjectAnalyzer;

public class LongRestObjectAnalyzer implements RestObjectAnalyzer<Long>{

  public Long toValue(String xmlFragment) {
    if (xmlFragment != null && !xmlFragment.equals("null")) {
      return Long.parseLong(xmlFragment);
    }
    else {
      return null;
    }
  }

  public String toXmlFragment(Long value) {
    if (value == null) {
      return "null";
    }

    return Long.toString(value);
  }
}
